home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CStaticTextPane 1.0 / CStaticTextPane / CStaticTextPane.c next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  4.2 KB  |  130 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.  CStaticTextPane.c
  3.  
  4.     Class for displaying static text. NOTE: The superclass is CTextPane; this
  5.     should be changed to CEditText for other applications.
  6.     
  7.     Copyright (C) 1992 by Brown University. All rights reserved.
  8.  
  9.     Permission is granted to any individual or institution to use, copy,
  10.     or redistribute the binary version of this software and its
  11.     documentation provided this notice and the copyright notices are
  12.     retained.  Permission is granted to any individual or non-profit
  13.     institution to use, copy, modify, or redistribute the source files
  14.     of this software provided this notice and the copyright notices are
  15.     retained.  This software may not be distributed for profit, either
  16.     in original form or in derivative works, nor can the source be
  17.     distributed to other than an individual or a non-profit institution.
  18.     Any  individual or group interested in seeing and/or using these
  19.     source files but who are prevented from doing so by the above
  20.     constraints should contact Don Wolfe, Vice-President for Computer 
  21.     Systems at Brown University, (401) 863-7247, for possible
  22.     software licensing of the source developed at Brown.
  23.  
  24.     Brown University and Andrew James Gilmartin make no representations
  25.     about the suitability of this software for any purpose.
  26.  
  27.      BROWN UNIVERSITY AND ANDREW JAMES GILMARTIN GIVE NO WARRANTY, EITHER
  28.     EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
  29.     INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
  30.     WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
  31.  
  32.     AUTHOR: Andrew_Gilmartin@Brown.Edu
  33.     REVISION: 1
  34.  
  35. ******************************************************************************/
  36.  
  37. #include <Exceptions.h>
  38. #include <Commands.h>
  39. #include <Constants.h>
  40. #include <CBartender.h>
  41. #include "CStaticTextPane.h"
  42. #include "IsCursorKey.h"
  43.  
  44.  
  45. extern CBartender* gBartender;
  46.  
  47.  
  48.  
  49. /******************************************************************************
  50.  IStaticTextPane
  51.  
  52. ******************************************************************************/
  53.  
  54. void CStaticTextPane::IStaticTextPane
  55.     ( CView *anEnclosure, CBureaucrat *aSupervisor, short lineWidth )
  56. {
  57.     ITextPane( anEnclosure, aSupervisor, lineWidth );
  58.  
  59. } /* IStaticTextPane */
  60.  
  61.  
  62.  
  63. /******************************************************************************
  64.  UpdateMenus
  65.  
  66.     Can't modify the content so make sure cut, paste, and clear menu items
  67.     are disabled. NOTE: A use can copy content.
  68. ******************************************************************************/
  69.  
  70. void CStaticTextPane::UpdateMenus( void )
  71. {
  72.     inherited::UpdateMenus();
  73.     
  74.     gBartender->DisableCmd( cmdCut );
  75.     gBartender->DisableCmd( cmdPaste );
  76.     gBartender->DisableCmd( cmdClear );
  77.     
  78. } /* UpdateMenus */
  79.  
  80.  
  81.  
  82. /******************************************************************************
  83.  DoCommand
  84.  
  85.     Just in case DoCommand is called with cut, paste, or clear commands
  86.     ignore them. Perhaps this should be an assert, but suspect this will
  87.     not work in practice.
  88. ******************************************************************************/
  89.  
  90. void CStaticTextPane::DoCommand( long theCommand )
  91. {
  92.     if ( theCommand != cmdPaste && theCommand != cmdCut && theCommand != cmdClear )
  93.         inherited::DoCommand( theCommand );
  94.  
  95. } /* DoCommand */
  96.  
  97.  
  98.  
  99. /******************************************************************************
  100.  DoKeyDown
  101.  
  102.     The user can use the navigation keys to move around the text, but not
  103.     keys that modify the text.
  104. ******************************************************************************/
  105.  
  106. void CStaticTextPane::DoKeyDown
  107.     ( char theChar, Byte keyCode, EventRecord *macEvent )
  108. {
  109.     if ( IsNavigationKey( theChar, keyCode ) )
  110.            inherited::DoKeyDown( theChar, keyCode, macEvent );
  111.  
  112. } /* DoKeyDown */
  113.  
  114.  
  115.  
  116. /******************************************************************************
  117.  DoAutoKey
  118.  
  119.     The user can use the navigation keys to move around the text, but not
  120.     keys that modify the text. Perhaps I should just call DoKeyDown().
  121. ******************************************************************************/
  122.  
  123. void CStaticTextPane::DoAutoKey
  124.     ( char theChar, Byte keyCode, EventRecord *macEvent )
  125. {
  126.     if ( IsNavigationKey( theChar, keyCode ) )
  127.            inherited::DoAutoKey( theChar, keyCode, macEvent );
  128.     
  129. } /* DoAutoKey */
  130.